<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>    
    <div id="app">
        <div>{{msg}}</div>
        <div>{{str}}</div>
        <hr/>
        <book></book>
        <hr/>
        <reader></reader>
        <hr/>

    </div>

    <div id="app2">
        <h1>app2</h1>
        <!-- 用不成book组件 -->
        <book></book>
    </div>
    <script src="./js/vue.global.js"></script>
    <script>

        let book = {
            template:`<div>书籍组件</div><div>书籍组件2</div>`
        }

        let reader = {
            template:`<div>读者</div><book></book>`
        }
       
        let app = Vue.createApp({
            data(){
                return {
                    msg:"hello",
                    str:"hi"
                }
            }            
        });

        // 在app里全局注册的组件，不会影响其它app。
        app.component("book",book);
        app.component("reader",reader);
      
        app.mount("#app");

        let app2 = Vue.createApp({
            data(){
                return {

                }
            }
        });

        app2.mount("#app2");

    </script>
</body>
</html>